<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
$this->load->helper('url');
?>	<table id="tt" class="easyui-datagrid"></table>
	
	
	<div id="tb" style="padding:10px;5px;height:auto">
		<div>
			编号: <input id="id" class="easyui-textbox" style="width:80px">
			用户名: <input id="username" class="easyui-textbox" style="width:100px">
			日期 从: <input id="start" class="easyui-datebox" style="width:100px">
			到: <input id="end" class="easyui-datebox" style="width:100px">
			状态：
			<select id="status" class="easyui-combobox" style="width:100px">
				<option value="-1">全部</option>
				<option value="0">等待处理</option>
				<option value="1">已充值</option>
				<option value="2">处理中</option>
				<option value="3">已撤销</option>
				<option value="4">充值失败</option>
			</select>
			币种：
			<select id="coin_id" class="easyui-combobox" style="width:100px">
				<option value="0">全部</option>
				
<?php
foreach ($coins as $v) {
?>				<option value="<?php echo $v['id'];?>"><?php echo $v['cn_name'];?></option>
				<?php
}

?>			</select>
			<a href="#" onclick="doSearch()" class="easyui-linkbutton" iconCls="icon-search">搜索</a>
			<script type="text/javascript">
			function doSearch(){
				$('#tt').datagrid('load',{
					id: $('#id').val(),
					username: $('#username').val(),
					start: $('#start').val(),
					end: $('#end').val(),
					status: $('#status').val(),
					coin_id: $('#coin_id').val()
				});
			}
			</script>
		</div>
	</div>
	<div id="win"></div>

<script language="javascript">

$(function(){
	$('#tt').datagrid({
		url:'<?php echo site_url('draw_coin/data');?>',
		pagination:true,
		pageSize:20,
		toolbar:'#tb',
		checkbox:true,
		fit:true,
		border:false,
		idField:'id',
		'columns':[[
			{field:'ck',checkbox:'true'},
			{field:'id',width:'9%',title:'编号'},
			{field:'coin_name',width:'9%',title:'币种'},
			{field:'num',width:'10%',title:'转出数量'},
			{field:'username',width:'10%',title:'转出用户'},
			{field:'address',width:'20%',title:'转出地址'},
			{field:'add_time',width:'10%',title:'转出时间'},
			{field:'status',width:'10%',title:'状态',formatter:function(value,row,index){
				if(row.status == 0) return '等待处理';
				else if(row.status == 1) return '已提现';
				else if(row.status == 2) return '处理中';
				else if(row.status == 3) return '已撤销';
				else if(row.status == 4) return '提现失败';
			}},
			{field:'action',width:'10%',title:'操作',formatter:function(value,row,index){
				if(row.status == 0) return  '<a class="begin-btn list_link" data-status="2" data-id="'+row.id+'">开始处理</a>';
				else if(row.status == 2) return  '<a class="succ-btn list_link" data-status="1" data-id="'+row.id+'">确认提现</a>';
				
			}},
		]],
		onLoadSuccess:function(data){$(".list_link").linkbutton()}
	});

	$.set_status('.begin-btn','<?php echo site_url('draw_coin/set_status');?>');
	$.set_status('.succ-btn','<?php echo site_url('draw_coin/set_status');?>');
});
function doSearch(){
	$('#tt').datagrid('load',{
		id: $('#id').val(),
		name: $('#name').val()
	});
}
</script>